file (COPY test-audio DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/audio-write-tests)

set (AUDIOFILE_TESTS Tests)

file (GLOB AUDIOFILE_TESTS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
source_group (TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${AUDIOFILE_TESTS_SOURCES})

add_executable (${AUDIOFILE_TESTS} ${AUDIOFILE_TESTS_SOURCES})
target_include_directories (${AUDIOFILE_TESTS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries (${AUDIOFILE_TESTS} PUBLIC AudioFile)
target_compile_features (${AUDIOFILE_TESTS} PRIVATE cxx_std_17)
target_compile_definitions (${AUDIOFILE_TESTS} PUBLIC
  -D_USE_MATH_DEFINES # needed for M_PI macro
  -DPROJECT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}")

add_test (NAME ${AUDIOFILE_TESTS} COMMAND ${AUDIOFILE_TESTS})